const http=require('http')
const server=http.createServer((req,res)=>{
    res.writeHead(200,{
        'Access-Control-Allow-Origin':'http://localhost:5500',
        //*表示所有域名都可以访问，也可以指定域名，也可以指定http://127.0.0.1:5500
        'Access-Control-Allow-Methods':'GET,POST',
        'Access-Control-Allow-Headers':'Content-Type',
        'Access-Control-Allow-Credentials':'true'
    })
    res.end('hello cors')
})
server.listen(3000,()=>{
    console.log('server is running at http://localhost:3000')
})
